const mysql = require('mysql2/promise');

async function query(){
  const connection = await mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'mysql_password',
    database: 'orm',
  })
  try{
    const [result,fields] = await connection.execute(`select * from tags where id=?`,[1])
    console.log(result);
    console.log(fields);
  }catch (err){
    console.log(err);
  }
}

query().catch(err=>{
  console.log(err);
}).finally(()=>{
  // 查询结束终止程序
  process.exit(0);
})
